import { createApp } from "vue";
import App from "./App.vue";
import router from "./router/router";
import pinia from "./store/store.js";
import "@/assets/icon/iconfont.css";
import useStore from "@/store";

import "element-plus/theme-chalk/el-message.css";
import "element-plus/theme-chalk/el-message-box.css";
import "element-plus/theme-chalk/el-loading.css";
import "element-plus/theme-chalk/el-message.css";
import "element-plus/theme-chalk/el-notification.css";
import "element-plus/theme-chalk/el-message-box.css";

import VMdEditor from "@kangc/v-md-editor";
import "katex/dist/katex.min.css"; // 引入样式文件
import VueMarkdownEditor from "@kangc/v-md-editor";
import "@kangc/v-md-editor/lib/style/base-editor.css";
import githubTheme from "@kangc/v-md-editor/lib/theme/github.js";
import "@kangc/v-md-editor/lib/theme/style/github.css";
import createTipPlugin from "@kangc/v-md-editor/lib/plugins/tip/index";
import "@kangc/v-md-editor/lib/plugins/tip/tip.css";
import createCopyCodePlugin from "@kangc/v-md-editor/lib/plugins/copy-code/index";
import "@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css";
import createEmojiPlugin from "@kangc/v-md-editor/lib/plugins/emoji/index";
import "@kangc/v-md-editor/lib/plugins/emoji/emoji.css";
import createKatexPlugin from "@kangc/v-md-editor/lib/plugins/katex/cdn";
import createLineNumbertPlugin from "@kangc/v-md-editor/lib/plugins/line-number/index";
import createAlignPlugin from "@kangc/v-md-editor/lib/plugins/align";
import eventBus from "vue3-eventbus";
import { getAvatarUrl } from "@/utils/global.js";

// highlightjs
import hljs from "highlight.js";

VMdEditor.use(githubTheme, {
  Hljs: hljs,
});
VueMarkdownEditor.use(createKatexPlugin());
VueMarkdownEditor.use(createTipPlugin());
VueMarkdownEditor.use(createCopyCodePlugin());
VueMarkdownEditor.use(createEmojiPlugin());
VueMarkdownEditor.use(createLineNumbertPlugin());
VueMarkdownEditor.use(createAlignPlugin());

const app = createApp(App);
app.use(eventBus);
app.use(router);
app.config.globalProperties.$router = router;
app.config.globalProperties.$getAvatarUrl = getAvatarUrl;

app.use(pinia);
app.config.globalProperties.$store = useStore();

app.use(VMdEditor);

app.mount("#app");
